package com.jump.user.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by fangxiao on 15/9/5.
 */
public class ValidateUtil {



    public static boolean isEmpty(String info) {
        return "".equals(info);

    }

    public static boolean isEmail(String email){
        boolean flag = false;
        try{
            String check = "^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
            Pattern regex = Pattern.compile(check);
            Matcher matcher = regex.matcher(email);
            flag = matcher.matches();
        }catch(Exception e){
            flag = false;
        }
        return flag;
    }

    public static boolean isMobile(String str) {
        Pattern p = null;
        Matcher m = null;
        boolean b = false;
        p = Pattern.compile("^[1][3,4,5,8][0-9]{9}$"); // 验证手机号
        m = p.matcher(str);
        b = m.matches();
        return b;
    }


//    public static void main(String[] args) {
//        System.out.println(isMobile("13243214333"));
//    }
}
